<?php

/**
 * 
 */
    
class Plugin
{
    protected $scope; // objet_methode || template => (array)
    protected $droits; // VISITOR || USER || ADMIN
    protected $nom;
    protected $desc;
    protected $className;
    protected $uniId; // MD5 du nom SVP
    protected $content;
    protected $version;
    
    protected function __construct(){
    }
    
    public function getDroits(){
        return $this->droits;
    }

    public function getArray() {
        return array(
            'NOM_PLUGIN'     => $this->nom, 
            'DROITS_PLUGIN'  => $this->droits,
            'SCOPE_PLUGIN'   => implode(',',$this->scope), 
            'UNIID_PLUGIN'   => $this->uniId,
            'CONTENT_PLUGIN' => $this->content,
            'VERSION_PLUGIN' => $this->version,
            'DESC_PLUGIN'    => $this->desc);
    }

    public function action() {
        $p = isset($_POST['PLUGIN']) ? $_POST['PLUGIN'] : null;
        $p = isset($_GET['PLUGIN'])  ? $_GET['PLUGIN'] : $p;
        if($p != $this->className) return 'nop';
    }
    
    protected function ok(){
        global $IS_ADMIN, $IDENTIFICATION_OK;
        return (($this->droits == 'ADMIN' && $IS_ADMIN) ||          
                ($this->droits == 'USER'  && $IDENTIFICATION_OK) ||
                ($this->droits == 'VISITOR'));
        
    }

    public function getScope(){
        return $this->scope;
    }
    
    public function getClassName(){
        return $this->className;
    }
    
    protected function createTable()
    {
        //--- todo
    }
}

    

?>
